
clc;
close all;
WORDS = dec2bin(0:QAMary-1,n_bits)
WORDS =fliplr(WORDS);

count0 = 1;
count1 = 1;
index0 = zeros(QAMary/2,n_bits);
index1 = zeros(QAMary/2,n_bits);

for j = 1:1:n_bits
        for i = 1:1:QAMary
    if(WORDS(i,j)=='0')
        index0(count0,j) =i;
     count0 = count0+1;
    end
    if(WORDS(i,j)=='1')
        index1(count1,j) =i;
     count1 = count1+1;
    end
   
        end
   count0 = 1;
   
   count1 = 1;
end
    
zeromatrix = zeros(32,6);
onematrix  = zeros(32,6);
zeromatrix(1:QAMary/2,1:n_bits) = QAM(index0);

onematrix(1:QAMary/2,1:n_bits) = QAM(index1);